<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>活动海报模板</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: "Microsoft YaHei", Arial, sans-serif;
            background: transparent;
        }
        
        /* 海报容器 */
        .poster-container {
            width: 700px;
            height: 1000px;
            position: relative;
            overflow: hidden;
            background: linear-gradient(to bottom, #fd5c63, #f85032);
            color: white;
        }
        
        /* 背景装饰 */
        .bg-decoration {
            position: absolute;
            opacity: 0.1;
            z-index: 1;
        }
        
        .bg-circle {
            width: 300px;
            height: 300px;
            border-radius: 50%;
            background: white;
            position: absolute;
        }
        
        .bg-circle.top-right {
            top: -100px;
            right: -100px;
        }
        
        .bg-circle.bottom-left {
            bottom: -100px;
            left: -100px;
        }
        
        /* 内容容器 */
        .content {
            position: relative;
            z-index: 2;
            height: 100%;
            padding: 40px;
            display: flex;
            flex-direction: column;
        }
        
        /* 标题区域 */
        .header {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .event-title {
            font-size: 60px;
            font-weight: bold;
            margin-bottom: 10px;
            line-height: 1.2;
            text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
        }
        
        .event-date {
            font-size: 28px;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 2px;
        }
        
        /* 主要内容区域 */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        /* 优惠信息 */
        .discount-info {
            background: rgba(255, 255, 255, 0.15);
            border-radius: 10px;
            padding: 30px;
            margin-bottom: 40px;
            text-align: center;
        }
        
        .discount-value {
            font-size: 100px;
            font-weight: bold;
            line-height: 1;
            margin-bottom: 20px;
            color: #fff200;
            text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
        }
        
        .discount-description {
            font-size: 32px;
            line-height: 1.4;
        }
        
        /* 活动说明 */
        .event-description {
            font-size: 24px;
            line-height: 1.6;
            margin-bottom: 30px;
            text-align: center;
        }
        
        /* 底部区域 */
        .footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-top: 30px;
            border-top: 2px dashed rgba(255, 255, 255, 0.3);
        }
        
        /* 店铺信息 */
        .shop-info {
            display: flex;
            align-items: center;
        }
        
        .shop-logo {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            border: 2px solid white;
            margin-right: 15px;
            object-fit: cover;
        }
        
        .shop-details {
            max-width: 300px;
        }
        
        .shop-name {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 5px;
        }
        
        .shop-address {
            font-size: 16px;
            opacity: 0.8;
        }
        
        /* 二维码 */
        .qrcode-container {
            text-align: center;
        }
        
        .qrcode {
            width: 120px;
            height: 120px;
            background: white;
            padding: 6px;
            border-radius: 10px;
            margin-bottom: 8px;
        }
        
        .qrcode-text {
            font-size: 16px;
        }
        
        /* 限时标签 */
        .limited-time-tag {
            position: absolute;
            top: 40px;
            right: -60px;
            background: #fff200;
            color: #d81e06;
            padding: 10px 80px;
            font-size: 22px;
            font-weight: bold;
            transform: rotate(45deg);
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        }
    </style>
</head>
<body>
    <div class="poster-container" id="custom-poster">
        <!-- 背景装饰 -->
        <div class="bg-circle top-right"></div>
        <div class="bg-circle bottom-left"></div>
        
        <!-- 限时标签 -->
        <div class="limited-time-tag" id="limited-time-tag">限时优惠</div>
        
        <!-- 内容容器 -->
        <div class="content">
            <!-- 标题区域 -->
            <div class="header">
                <h1 class="event-title" id="event-title">夏季大促销</h1>
                <div class="event-date" id="event-date">2023年6月1日-6月30日</div>
            </div>
            
            <!-- 主要内容区域 -->
            <div class="main-content">
                <!-- 优惠信息 -->
                <div class="discount-info">
                    <div class="discount-value" id="discount-value">5折起</div>
                    <div class="discount-description" id="discount-description">全场商品限时折扣</div>
                </div>
                
                <!-- 活动说明 -->
                <div class="event-description" id="event-description">
                    活动期间，全场商品五折起，满300减50，满500减100，新客户额外享受9折优惠。数量有限，先到先得！
                </div>
            </div>
            
            <!-- 底部区域 -->
            <div class="footer">
                <!-- 店铺信息 -->
                <div class="shop-info">
                    <img class="shop-logo" id="shop-logo" src="" alt="店铺logo">
                    <div class="shop-details">
                        <div class="shop-name" id="shop-name">品牌专卖店</div>
                        <div class="shop-address" id="shop-address">地址：xx市xx区xx街xx号</div>
                    </div>
                </div>
                
                <!-- 二维码 -->
                <div class="qrcode-container">
                    <img class="qrcode" id="qrcode" src="" alt="二维码">
                    <div class="qrcode-text" id="qrcode-text">扫码关注</div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 根据传入的数据生成模板
        function generateTemplate(data) {
            // 默认值
            const defaults = {
                title: '夏季大促销',
                date: '2023年6月1日-6月30日',
                discountValue: '5折起',
                discountDescription: '全场商品限时折扣',
                description: '活动期间，全场商品五折起，满300减50，满500减100，新客户额外享受9折优惠。数量有限，先到先得！',
                shopName: '品牌专卖店',
                shopAddress: '地址：xx市xx区xx街xx号',
                shopLogo: '',
                qrcode: '',
                qrcodeText: '扫码关注',
                limitedTimeTag: '限时优惠',
                showLimitedTimeTag: true,
                backgroundColor: 'linear-gradient(to bottom, #fd5c63, #f85032)' // 可自定义背景色
            };
            
            // 合并数据
            const templateData = {...defaults, ...data};
            
            // 构建HTML
            let html = `
                <!-- 背景装饰 -->
                <div class="bg-circle top-right"></div>
                <div class="bg-circle bottom-left"></div>
                
                ${templateData.showLimitedTimeTag ? `<div class="limited-time-tag" id="limited-time-tag">${templateData.limitedTimeTag}</div>` : ''}
                
                <!-- 内容容器 -->
                <div class="content">
                    <!-- 标题区域 -->
                    <div class="header">
                        <h1 class="event-title" id="event-title">${templateData.title}</h1>
                        <div class="event-date" id="event-date">${templateData.date}</div>
                    </div>
                    
                    <!-- 主要内容区域 -->
                    <div class="main-content">
                        <!-- 优惠信息 -->
                        <div class="discount-info">
                            <div class="discount-value" id="discount-value">${templateData.discountValue}</div>
                            <div class="discount-description" id="discount-description">${templateData.discountDescription}</div>
                        </div>
                        
                        <!-- 活动说明 -->
                        <div class="event-description" id="event-description">
                            ${templateData.description}
                        </div>
                    </div>
                    
                    <!-- 底部区域 -->
                    <div class="footer">
                        <!-- 店铺信息 -->
                        <div class="shop-info">
                            <img class="shop-logo" id="shop-logo" src="${templateData.shopLogo || ''}" alt="店铺logo">
                            <div class="shop-details">
                                <div class="shop-name" id="shop-name">${templateData.shopName}</div>
                                <div class="shop-address" id="shop-address">${templateData.shopAddress}</div>
                            </div>
                        </div>
                        
                        <!-- 二维码 -->
                        <div class="qrcode-container">
                            <img class="qrcode" id="qrcode" src="${templateData.qrcode || ''}" alt="二维码">
                            <div class="qrcode-text" id="qrcode-text">${templateData.qrcodeText}</div>
                        </div>
                    </div>
                </div>
            `;
            
            // 设置背景色
            document.querySelector('.poster-container').style.background = templateData.backgroundColor;
            
            return html;
        }
        
        // 如果是浏览器环境
        if (typeof window !== 'undefined' && typeof document !== 'undefined') {
            document.addEventListener('DOMContentLoaded', function() {
                // 可以在这里添加初始化代码
                console.log('活动海报模板初始化完成');
            });
        }
    </script>
</body>
</html> 